package kubayaxi.video.client.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import kubayaxi.video.client.service.IClientUserService;
import kubayaxi.video.mybatis.customize.model.user.dto.*;
import kubayaxi.video.mybatis.customize.model.user.vo.*;
import kubayaxi.video.service.base.common.request.BaseRequest;
import kubayaxi.video.service.base.common.response.ResponseResult;
import kubayaxi.video.service.base.common.vo.CommonPageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/client/user")
@Api(tags = "客户端【用户】")
public class ClientUserController {
    @Resource
    private IClientUserService clientUserService;

    @ApiOperation("获取历史记录列表")
    @PostMapping("/getVideoRecordList")
    public ResponseResult<CommonPageResult<GetVideoRecordListVO>> getVideoRecordList(@RequestBody BaseRequest dto){
        CommonPageResult<GetVideoRecordListVO> ans = clientUserService.getVideoRecordList(dto);
        return ResponseResult.success(ans);
    }

    @ApiOperation("删除历史记录")
    @PostMapping("/deleteHistory")
    public ResponseResult deleteHistory(@RequestBody BaseRequest<DeleteHistoryDTO> dto){
        clientUserService.deleteHistory(dto);
        return ResponseResult.success();
    }

    @ApiOperation("获取关注者或者粉丝列表")
    @PostMapping("/getFollow")
    public ResponseResult<List<GetFollowVO>> getFollow(@RequestBody BaseRequest<GetFollowDTO> dto){
        List<GetFollowVO> ans = clientUserService.getFollow(dto);
        return ResponseResult.success(ans);
    }

    @ApiOperation("获取用户关注者的动态列表")
    @PostMapping("/getDynamicList")
    public ResponseResult<CommonPageResult<GetDynamicListVO>> getDynamicList(@RequestBody BaseRequest dto){
        CommonPageResult<GetDynamicListVO> ans = clientUserService.getDynamicList(dto);
        return ResponseResult.success(ans);
    }

    @ApiOperation("获取当前用户详细信息")
    @PostMapping("/getUserInfo")
    public ResponseResult<GetUserInfoVO> getUserInfo(){
        GetUserInfoVO ans = clientUserService.getUserInfo();
        return ResponseResult.success(ans);
    }

    @ApiOperation("获取用户详细信息")
    @PostMapping("/getUserInfo2")
    public ResponseResult<GetUserInfoVO> getUserInfo2(@RequestBody BaseRequest<GetUserInfo2DTO> dto){
        GetUserInfoVO ans = clientUserService.getUserInfo2(dto);
        return ResponseResult.success(ans);
    }

    @ApiOperation("获取用户我的喜欢列表")
    @PostMapping("/getUserLikeList")
    public ResponseResult<CommonPageResult<GetUserLikeListVO>> getUserLikeList(@RequestBody BaseRequest dto){
        CommonPageResult<GetUserLikeListVO> ans = clientUserService.getUserLikeList(dto);
        return ResponseResult.success(ans);
    }

    @ApiOperation("删除我的喜欢")
    @PostMapping("/deleteLike")
    public ResponseResult deleteLike(@RequestBody BaseRequest<DeleteLikeDTO> dto){
        clientUserService.deleteLike(dto);
        return ResponseResult.success();
    }

    @ApiOperation("获取我的发布列表")
    @PostMapping("/getMyPublishList")
    public ResponseResult<CommonPageResult<GetMyPublishListVO>> getMyPublishList(@RequestBody BaseRequest dto){
        CommonPageResult<GetMyPublishListVO> ans = clientUserService.getMyPublishList(dto);
        return ResponseResult.success(ans);
    }

    @ApiOperation("修改个人信息")
    @PostMapping("/updateInfo")
    public ResponseResult updateInfo(@RequestBody BaseRequest<UpdateInfoDTO> dto){
        clientUserService.updateInfo(dto);
        return ResponseResult.success();
    }

    @ApiOperation("获取我的消息")
    @PostMapping("/myMessage")
    public ResponseResult<List<MyMessageVO>> myMessage(){
        List<MyMessageVO> ans = clientUserService.myMessage();
        return ResponseResult.success(ans);
    }


}
